<template>
  <div>
    <!-- <h1>首页</h1> -->
    <!-- 轮播图 -->
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(image, index) in images" :key="index">
        <img v-lazy="image" class="swipeImg" />
      </van-swipe-item>
    </van-swipe>
    <!-- 搜索栏 -->
    <van-search
      show-action
      label="上海"
      @click="goCity"
      placeholder="请输入小区或地址"
      @search="onSearch"
      background="rgba(0,0,0,0)"
      class="searchBox"
    >
      <template #action>
        <div @click="onSearchMap()" class="mapImg">
          <img src="@/assets/homeIconfont/mapIcon.png" width="100%" />
        </div>
      </template>
    </van-search>
    <!-- 列表 -->
    <div class="homeList">
      <div>
        <img src="@/assets/homeIconfont/homeList-1.png" alt="" />
        <h2>整租</h2>
      </div>
      <div>
        <img src="@/assets/homeIconfont/homeList-2.png" alt="" />
        <h2>合租</h2>
      </div>
      <div>
        <img src="@/assets/homeIconfont/homeList-3.png" alt="" />
        <h2>地图找房</h2>
      </div>
      <div>
        <img src="@/assets/homeIconfont/homeList-4.png" alt="" />
        <h2>去出租</h2>
      </div>
    </div>
    <div class="houseGroup">
      <h3>租房小组<span>更多</span></h3>
      <van-grid direction="horizontal" :column-num="2" :gutter="10" class="groupList">
  <van-grid-item icon="http://115.159.87.220:8080/img/groups/1.png" text="家住回龙观" />
  <van-grid-item icon="http://115.159.87.220:8080/img/groups/2.png" text="宜居四五环" />
  <van-grid-item icon="http://115.159.87.220:8080/img/groups/3.pngo" text="喧嚣三里屯" />
  <van-grid-item icon="http://115.159.87.220:8080/img/groups/4.png" text="比邻十号线" />
</van-grid>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FindHomeHome',

  data () {
    return {
      images: [
        'http://liufusong.top:8080/img/swiper/1.png',
        'http://liufusong.top:8080/img/swiper/2.png',
        'http://liufusong.top:8080/img/swiper/3.png'
      ]
    }
  },

  mounted () {},

  methods: {
    goCity () {
      console.log(333)
    },
    onSearchMap () {
      console.log(111)
    },
    onSearch () {
      console.log(222)
    }
  }
}
</script>

<style lang="less" scoped>
.swipeImg {
  width: 100%;
  height: 212px;
  vertical-align: top;
}
.mapImg {
  width: 25px;
  height: 24.8px;
  // background-color: red;
}
.searchBox {
  position: absolute;
  top: 25px;
  z-index: 2;
  width: 100%;
  padding: 0 10px;
  margin-left: 10px;
}
.homeList {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
  text-align: center;
  img {
    width: 60px;
    height: 60px;
  }
  h2 {
    font-size: 14px;
    line-height: 1.15;
    font-weight: 400;
  }
}
.houseGroup {
  background-color: #f6f5f6;
  h3 {
    padding: 10px 10px 0 10px;
    margin: 15px 0 15px 10px;
    color: #333;
    font-size: 15px;
    span {
      float: right;
      font-size: 14px;
      color: #787d82;
      font-weight: normal;
    }
  }
.groupList {
  padding-bottom: 10px;
  }
}
</style>
